<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/10/11
  Time: 8:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>password</title>
    <link type="text/css" rel="stylesheet" media="all" href="<%=request.getContextPath()%>/styles/global.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="<%=request.getContextPath()%>/styles/global_color.css"/>
</head>
<body>
<!--Logo区域开始-->
<div id="header">
    <img src="../images/logo.png" alt="logo" class="left"/>
    <a href="<%=request.getContextPath()%>/admins/exit">[退出]</a>
</div>
<!--Logo区域结束-->
<!--导航区域开始-->
<div id="navi">
    <c:import url="../navigation.jsp"/>
    <script>
        var li = document.getElementById("menu").children;
        var title = document.getElementsByTagName('title')[0].textContent;
        for (let i = 0; i < li.length; i++) {
            if (li[i].children[0].className.startsWith(title)){
                li[i].children[0].className = title + '_on';
            }
        }
    </script>
</div>
<script>
    function isValid(form) {
        if (form.newPassword.value !== form.rePassword.value) {
            alert("两次输入的密码不同！");
            return false;
        }
        else return true;
    }
</script>
<!--导航区域结束-->
<div id="main">
    <!--保存操作后的提示信息：成功或者失败-->
    <div id="save_result_info" class="save_success">保存成功！</div><!--保存失败，旧密码错误！-->
    <form action="<%=request.getContextPath()%>/user/modify.pw" method="post" class="main_form"
          onSubmit="return isValid(this);">
        <div class="text_info clearfix">
            <span>旧密码：</span>
        </div>
        <div class="input_info">

            <input name="password" type="password" class="width200"/>
            <span class="required">
                ${result.getFieldError("password").defaultMessage}
                ${error}
            </span>
        </div>
        <div class="text_info clearfix"><span>新密码：</span></div>
        <div class="input_info">
            <input name="newPassword" type="password" class="width200"/>
            <span class="required">${result.getFieldError("newPassword").defaultMessage}</span></div>
        <div class="text_info clearfix"><span>重复新密码：</span></div>
        <div class="input_info">
            <input name="rePassword" type="password" class="width200"/>
        </div>
        <div class="button_info clearfix">
            <input type="submit" value="保存" class="btn_save"/>
            <input type="reset" value="取消" class="btn_save"/>
            <input type="button" value="返回" class="btn_save" onclick="location.href='/index';"/>
        </div>

    </form>
</div>
<!--主要区域结束-->
<div id="footer">
    <p>[源自北美的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</p>
    <p>版权所有(C)云科技有限公司 </p>
</div>
</body>
</html>
